#include <SDL/SDL.h>
#include "../backend/zlibengn.h"
#include <iostream>
#include "../backend/utilities.h"
#include <vector>
#include <string>

#include "backend/baseCTF.h"

using namespace std;







int main(int argc, char **argv)
{
	//Test zlib
	ZlibEngine engine;
	int level = 6; //compression level. 0 to 9 (0 is no compression)
	engine.compress( "data.txt", "data.compressed", level);
	engine.decompress( "data.compressed", "data.uncompressed");
	// END Test zlib


	// String Utilities Test
	std::cout << tostring(1) << "\n";
	std::cout << tostring(-1) << "\n";
	std::cout << tostring(0) << "\n";
	std::cout << tostring(1456) << "\n";
	std::cout << tostring(-3431) << "\n\n\n";

	std::cout << tostring(1.23) << "\n";
	std::cout << tostring(-10.23) << "\n";
	std::cout << tostring(0.00) << "\n";
	std::cout << tostring(1456324.32) << "\n";
	std::cout << tostring(-3431.23344) << "\n";
	// END String Utilities Test


	if(SDL_Init(SDL_INIT_EVERYTHING) < 0)
        return -1;

	SDL_Surface *surface;
    if((surface = SDL_SetVideoMode(500, 500, 32, SDL_HWSURFACE | SDL_DOUBLEBUF)) == NULL)
        return -1;

    SDL_WM_SetCaption("SDL Demo", "SDL Demo");

	int lastFrame = SDL_GetTicks();

	bool running = true;
	while (running)
	{
		SDL_Event sdlEvent;
		while(SDL_PollEvent(&sdlEvent))
		{
            if (sdlEvent.type == SDL_QUIT)
			{
				running = false;
			}
		}

		Uint32 thisFrame = SDL_GetTicks();
		float dt = (thisFrame - lastFrame) / 1000.0f;
		lastFrame = thisFrame;

		SDL_Rect clearRect;
		clearRect.x = 0;
		clearRect.y = 0;
		clearRect.w = 500;
		clearRect.h = 500;
		SDL_FillRect(surface, &clearRect, 0);



		SDL_Flip(surface);
	}


	SDL_Quit();

	return 0;
}